package com.agent.platform.config;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自定义指标配置 - Prometheus导出
 */
@Configuration
public class MetricsConfig {

    @Bean
    public Counter llmCallCounter(MeterRegistry registry) {
        return Counter.builder("agent.llm.calls.total")
            .description("Total number of LLM API calls")
            .register(registry);
    }

    @Bean
    public Timer llmCallDuration(MeterRegistry registry) {
        return Timer.builder("agent.llm.call.duration")
            .description("LLM API call duration in seconds")
            .register(registry);
    }

    @Bean
    public Counter sessionStartCounter(MeterRegistry registry) {
        return Counter.builder("agent.sessions.started.total")
            .description("Total number of sessions started")
            .register(registry);
    }

    @Bean
    public Counter sessionStopCounter(MeterRegistry registry) {
        return Counter.builder("agent.sessions.stopped.total")
            .description("Total number of sessions stopped")
            .register(registry);
    }
}
